from goods.models import SpecificationOption, SPUSpecification
from rest_framework import serializers

class SpecViewSetSerializer(serializers.ModelSerializer):
    #1.重写spec
    spec=serializers.StringRelatedField(read_only=True)
    spec_id=serializers.IntegerField()
    class Meta:
        model= SpecificationOption
        fields="__all__"

class OptionSpecSerializer(serializers.ModelSerializer):
    class Meta:
        model=SPUSpecification
        fields=("id","name")